<!doctype html>
<html>
<head>
<meta charset='UTF-8'><meta name='viewport' content='width=device-width initial-scale=1'>

<link href='https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext' rel='stylesheet' type='text/css' /><style type='text/css'>html {overflow-x: initial !important;}:root { --bg-color:#ffffff; --text-color:#333333; --select-text-bg-color:#B5D6FC; --select-text-font-color:auto; --monospace:"Lucida Console",Consolas,"Courier",monospace; --title-bar-height:20px; }
.mac-os-11 { --title-bar-height:28px; }
html { font-size: 14px; background-color: var(--bg-color); color: var(--text-color); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
body { margin: 0px; padding: 0px; height: auto; inset: 0px; font-size: 1rem; line-height: 1.42857; overflow-x: hidden; background: inherit; tab-size: 4; }
iframe { margin: auto; }
a.url { word-break: break-all; }
a:active, a:hover { outline: 0px; }
.in-text-selection, ::selection { text-shadow: none; background: var(--select-text-bg-color); color: var(--select-text-font-color); }
#write { margin: 0px auto; height: auto; width: inherit; word-break: normal; overflow-wrap: break-word; position: relative; white-space: normal; overflow-x: visible; padding-top: 36px; }
#write.first-line-indent p { text-indent: 2em; }
#write.first-line-indent li p, #write.first-line-indent p * { text-indent: 0px; }
#write.first-line-indent li { margin-left: 2em; }
.for-image #write { padding-left: 8px; padding-right: 8px; }
body.typora-export { padding-left: 30px; padding-right: 30px; }
.typora-export .footnote-line, .typora-export li, .typora-export p { white-space: pre-wrap; }
.typora-export .task-list-item input { pointer-events: none; }
@media screen and (max-width: 500px) {
  body.typora-export { padding-left: 0px; padding-right: 0px; }
  #write { padding-left: 20px; padding-right: 20px; }
}
#write li > figure:last-child { margin-bottom: 0.5rem; }
#write ol, #write ul { position: relative; }
img { max-width: 100%; vertical-align: middle; image-orientation: from-image; }
button, input, select, textarea { color: inherit; font: inherit; }
input[type="checkbox"], input[type="radio"] { line-height: normal; padding: 0px; }
*, ::after, ::before { box-sizing: border-box; }
#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p, #write pre { width: inherit; }
#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p { position: relative; }
p { line-height: inherit; }
h1, h2, h3, h4, h5, h6 { break-after: avoid-page; break-inside: avoid; orphans: 4; }
p { orphans: 4; }
h1 { font-size: 2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.6rem; }
h4 { font-size: 1.4rem; }
h5 { font-size: 1.2rem; }
h6 { font-size: 1rem; }
.md-math-block, .md-rawblock, h1, h2, h3, h4, h5, h6, p { margin-top: 1rem; margin-bottom: 1rem; }
.hidden { display: none; }
.md-blockmeta { color: rgb(204, 204, 204); font-weight: 700; font-style: italic; }
a { cursor: pointer; }
sup.md-footnote { padding: 2px 4px; background-color: rgba(238, 238, 238, 0.7); color: rgb(85, 85, 85); border-radius: 4px; cursor: pointer; }
sup.md-footnote a, sup.md-footnote a:hover { color: inherit; text-transform: inherit; text-decoration: inherit; }
#write input[type="checkbox"] { cursor: pointer; width: inherit; height: inherit; }
figure { overflow-x: auto; margin: 1.2em 0px; max-width: calc(100% + 16px); padding: 0px; }
figure > table { margin: 0px; }
thead, tr { break-inside: avoid; break-after: auto; }
thead { display: table-header-group; }
table { border-collapse: collapse; border-spacing: 0px; width: 100%; overflow: auto; break-inside: auto; text-align: left; }
table.md-table td { min-width: 32px; }
.CodeMirror-gutters { border-right: 0px; background-color: inherit; }
.CodeMirror-linenumber { user-select: none; }
.CodeMirror { text-align: left; }
.CodeMirror-placeholder { opacity: 0.3; }
.CodeMirror pre { padding: 0px 4px; }
.CodeMirror-lines { padding: 0px; }
div.hr:focus { cursor: none; }
#write pre { white-space: pre-wrap; }
#write.fences-no-line-wrapping pre { white-space: pre; }
#write pre.ty-contain-cm { white-space: normal; }
.CodeMirror-gutters { margin-right: 4px; }
.md-fences { font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; overflow: visible; white-space: pre; background: inherit; position: relative !important; }
.md-fences-adv-panel { width: 100%; margin-top: 10px; text-align: center; padding-top: 0px; padding-bottom: 8px; overflow-x: auto; }
#write .md-fences.mock-cm { white-space: pre-wrap; }
.md-fences.md-fences-with-lineno { padding-left: 0px; }
#write.fences-no-line-wrapping .md-fences.mock-cm { white-space: pre; overflow-x: auto; }
.md-fences.mock-cm.md-fences-with-lineno { padding-left: 8px; }
.CodeMirror-line, twitterwidget { break-inside: avoid; }
svg { break-inside: avoid; }
.footnotes { opacity: 0.8; font-size: 0.9rem; margin-top: 1em; margin-bottom: 1em; }
.footnotes + .footnotes { margin-top: 0px; }
.md-reset { margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: top; background: 0px 0px; text-decoration: none; text-shadow: none; float: none; position: static; width: auto; height: auto; white-space: nowrap; cursor: inherit; -webkit-tap-highlight-color: transparent; line-height: normal; font-weight: 400; text-align: left; box-sizing: content-box; direction: ltr; }
li div { padding-top: 0px; }
blockquote { margin: 1rem 0px; }
li .mathjax-block, li p { margin: 0.5rem 0px; }
li blockquote { margin: 1rem 0px; }
li { margin: 0px; position: relative; }
blockquote > :last-child { margin-bottom: 0px; }
blockquote > :first-child, li > :first-child { margin-top: 0px; }
.footnotes-area { color: rgb(136, 136, 136); margin-top: 0.714rem; padding-bottom: 0.143rem; white-space: normal; }
#write .footnote-line { white-space: pre-wrap; }
@media print {
  body, html { border: 1px solid transparent; height: 99%; break-after: avoid; break-before: avoid; font-variant-ligatures: no-common-ligatures; }
  #write { margin-top: 0px; padding-top: 0px; border-color: transparent !important; padding-bottom: 0px !important; }
  .typora-export * { -webkit-print-color-adjust: exact; }
  .typora-export #write { break-after: avoid; }
  .typora-export #write::after { height: 0px; }
  .is-mac table { break-inside: avoid; }
  .typora-export-show-outline .typora-export-sidebar { display: none; }
}
.footnote-line { margin-top: 0.714em; font-size: 0.7em; }
a img, img a { cursor: pointer; }
pre.md-meta-block { font-size: 0.8rem; min-height: 0.8rem; white-space: pre-wrap; background: rgb(204, 204, 204); display: block; overflow-x: hidden; }
p > .md-image:only-child:not(.md-img-error) img, p > img:only-child { display: block; margin: auto; }
#write.first-line-indent p > .md-image:only-child:not(.md-img-error) img { left: -2em; position: relative; }
p > .md-image:only-child { display: inline-block; width: 100%; }
#write .MathJax_Display { margin: 0.8em 0px 0px; }
.md-math-block { width: 100%; }
.md-math-block:not(:empty)::after { display: none; }
.MathJax_ref { fill: currentcolor; }
[contenteditable="true"]:active, [contenteditable="true"]:focus, [contenteditable="false"]:active, [contenteditable="false"]:focus { outline: 0px; box-shadow: none; }
.md-task-list-item { position: relative; list-style-type: none; }
.task-list-item.md-task-list-item { padding-left: 0px; }
.md-task-list-item > input { position: absolute; top: 0px; left: 0px; margin-left: -1.2em; margin-top: calc(1em - 10px); border: none; }
.math { font-size: 1rem; }
.md-toc { min-height: 3.58rem; position: relative; font-size: 0.9rem; border-radius: 10px; }
.md-toc-content { position: relative; margin-left: 0px; }
.md-toc-content::after, .md-toc::after { display: none; }
.md-toc-item { display: block; color: rgb(65, 131, 196); }
.md-toc-item a { text-decoration: none; }
.md-toc-inner:hover { text-decoration: underline; }
.md-toc-inner { display: inline-block; cursor: pointer; }
.md-toc-h1 .md-toc-inner { margin-left: 0px; font-weight: 700; }
.md-toc-h2 .md-toc-inner { margin-left: 2em; }
.md-toc-h3 .md-toc-inner { margin-left: 4em; }
.md-toc-h4 .md-toc-inner { margin-left: 6em; }
.md-toc-h5 .md-toc-inner { margin-left: 8em; }
.md-toc-h6 .md-toc-inner { margin-left: 10em; }
@media screen and (max-width: 48em) {
  .md-toc-h3 .md-toc-inner { margin-left: 3.5em; }
  .md-toc-h4 .md-toc-inner { margin-left: 5em; }
  .md-toc-h5 .md-toc-inner { margin-left: 6.5em; }
  .md-toc-h6 .md-toc-inner { margin-left: 8em; }
}
a.md-toc-inner { font-size: inherit; font-style: inherit; font-weight: inherit; line-height: inherit; }
.footnote-line a:not(.reversefootnote) { color: inherit; }
.reversefootnote { font-family: ui-monospace, sans-serif; }
.md-attr { display: none; }
.md-fn-count::after { content: "."; }
code, pre, samp, tt { font-family: var(--monospace); }
kbd { margin: 0px 0.1em; padding: 0.1em 0.6em; font-size: 0.8em; color: rgb(36, 39, 41); background: rgb(255, 255, 255); border: 1px solid rgb(173, 179, 185); border-radius: 3px; box-shadow: rgba(12, 13, 14, 0.2) 0px 1px 0px, rgb(255, 255, 255) 0px 0px 0px 2px inset; white-space: nowrap; vertical-align: middle; }
.md-comment { color: rgb(162, 127, 3); opacity: 0.6; font-family: var(--monospace); }
code { text-align: left; vertical-align: initial; }
a.md-print-anchor { white-space: pre !important; border-width: initial !important; border-style: none !important; border-color: initial !important; display: inline-block !important; position: absolute !important; width: 1px !important; right: 0px !important; outline: 0px !important; background: 0px 0px !important; text-decoration: initial !important; text-shadow: initial !important; }
.os-windows.monocolor-emoji .md-emoji { font-family: "Segoe UI Symbol", sans-serif; }
.md-diagram-panel > svg { max-width: 100%; }
[lang="flow"] svg, [lang="mermaid"] svg { max-width: 100%; height: auto; }
[lang="mermaid"] .node text { font-size: 1rem; }
table tr th { border-bottom: 0px; }
video { max-width: 100%; display: block; margin: 0px auto; }
iframe { max-width: 100%; width: 100%; border: none; }
.highlight td, .highlight tr { border: 0px; }
mark { background: rgb(255, 255, 0); color: rgb(0, 0, 0); }
.md-html-inline .md-plain, .md-html-inline strong, mark .md-inline-math, mark strong { color: inherit; }
.md-expand mark .md-meta { opacity: 0.3 !important; }
mark .md-meta { color: rgb(0, 0, 0); }
@media print {
  .typora-export h1, .typora-export h2, .typora-export h3, .typora-export h4, .typora-export h5, .typora-export h6 { break-inside: avoid; }
}
.md-diagram-panel .messageText { stroke: none !important; }
.md-diagram-panel .start-state { fill: var(--node-fill); }
.md-diagram-panel .edgeLabel rect { opacity: 1 !important; }
.md-fences.md-fences-math { font-size: 1em; }
.md-fences-advanced:not(.md-focus) { padding: 0px; white-space: nowrap; border: 0px; }
.md-fences-advanced:not(.md-focus) { background: inherit; }
.typora-export-show-outline .typora-export-content { max-width: 1440px; margin: auto; display: flex; flex-direction: row; }
.typora-export-sidebar { width: 300px; font-size: 0.8rem; margin-top: 80px; margin-right: 18px; }
.typora-export-show-outline #write { --webkit-flex:2; flex: 2 1 0%; }
.typora-export-sidebar .outline-content { position: fixed; top: 0px; max-height: 100%; overflow: hidden auto; padding-bottom: 30px; padding-top: 60px; width: 300px; }
@media screen and (max-width: 1024px) {
  .typora-export-sidebar, .typora-export-sidebar .outline-content { width: 240px; }
}
@media screen and (max-width: 800px) {
  .typora-export-sidebar { display: none; }
}
.outline-content li, .outline-content ul { margin-left: 0px; margin-right: 0px; padding-left: 0px; padding-right: 0px; list-style: none; }
.outline-content ul { margin-top: 0px; margin-bottom: 0px; }
.outline-content strong { font-weight: 400; }
.outline-expander { width: 1rem; height: 1.42857rem; position: relative; display: table-cell; vertical-align: middle; cursor: pointer; padding-left: 4px; }
.outline-expander::before { content: ""; position: relative; font-family: Ionicons; display: inline-block; font-size: 8px; vertical-align: middle; }
.outline-item { padding-top: 3px; padding-bottom: 3px; cursor: pointer; }
.outline-expander:hover::before { content: ""; }
.outline-h1 > .outline-item { padding-left: 0px; }
.outline-h2 > .outline-item { padding-left: 1em; }
.outline-h3 > .outline-item { padding-left: 2em; }
.outline-h4 > .outline-item { padding-left: 3em; }
.outline-h5 > .outline-item { padding-left: 4em; }
.outline-h6 > .outline-item { padding-left: 5em; }
.outline-label { cursor: pointer; display: table-cell; vertical-align: middle; text-decoration: none; color: inherit; }
.outline-label:hover { text-decoration: underline; }
.outline-item:hover { border-color: rgb(245, 245, 245); background-color: var(--item-hover-bg-color); }
.outline-item:hover { margin-left: -28px; margin-right: -28px; border-left: 28px solid transparent; border-right: 28px solid transparent; }
.outline-item-single .outline-expander::before, .outline-item-single .outline-expander:hover::before { display: none; }
.outline-item-open > .outline-item > .outline-expander::before { content: ""; }
.outline-children { display: none; }
.info-panel-tab-wrapper { display: none; }
.outline-item-open > .outline-children { display: block; }
.typora-export .outline-item { padding-top: 1px; padding-bottom: 1px; }
.typora-export .outline-item:hover { margin-right: -8px; border-right: 8px solid transparent; }
.typora-export .outline-expander::before { content: "+"; font-family: inherit; top: -1px; }
.typora-export .outline-expander:hover::before, .typora-export .outline-item-open > .outline-item > .outline-expander::before { content: "−"; }
.typora-export-collapse-outline .outline-children { display: none; }
.typora-export-collapse-outline .outline-item-open > .outline-children, .typora-export-no-collapse-outline .outline-children { display: block; }
.typora-export-no-collapse-outline .outline-expander::before { content: "" !important; }
.typora-export-show-outline .outline-item-active > .outline-item .outline-label { font-weight: 700; }
.md-inline-math-container mjx-container { zoom: 0.95; }


:root {
    --side-bar-bg-color: #fafafa;
    --control-text-color: #777;
}

@include-when-export url(https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext);

/* open-sans-regular - latin-ext_latin */
  /* open-sans-italic - latin-ext_latin */
    /* open-sans-700 - latin-ext_latin */
    /* open-sans-700italic - latin-ext_latin */
  html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: "Open Sans","Clear Sans", "Helvetica Neue", Helvetica, Arial, 'Segoe UI Emoji', sans-serif;
    color: rgb(51, 51, 51);
    line-height: 1.6;
}

#write {
    max-width: 860px;
  	margin: 0 auto;
  	padding: 30px;
    padding-bottom: 100px;
}

@media only screen and (min-width: 1400px) {
	#write {
		max-width: 1024px;
	}
}

@media only screen and (min-width: 1800px) {
	#write {
		max-width: 1200px;
	}
}

#write > ul:first-child,
#write > ol:first-child{
    margin-top: 30px;
}

a {
    color: #4183C4;
}
h1,
h2,
h3,
h4,
h5,
h6 {
    position: relative;
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-weight: bold;
    line-height: 1.4;
    cursor: text;
}
h1:hover a.anchor,
h2:hover a.anchor,
h3:hover a.anchor,
h4:hover a.anchor,
h5:hover a.anchor,
h6:hover a.anchor {
    text-decoration: none;
}
h1 tt,
h1 code {
    font-size: inherit;
}
h2 tt,
h2 code {
    font-size: inherit;
}
h3 tt,
h3 code {
    font-size: inherit;
}
h4 tt,
h4 code {
    font-size: inherit;
}
h5 tt,
h5 code {
    font-size: inherit;
}
h6 tt,
h6 code {
    font-size: inherit;
}
h1 {
    font-size: 2.25em;
    line-height: 1.2;
    border-bottom: 1px solid #eee;
}
h2 {
    font-size: 1.75em;
    line-height: 1.225;
    border-bottom: 1px solid #eee;
}

/*@media print {
    .typora-export h1,
    .typora-export h2 {
        border-bottom: none;
        padding-bottom: initial;
    }

    .typora-export h1::after,
    .typora-export h2::after {
        content: "";
        display: block;
        height: 100px;
        margin-top: -96px;
        border-top: 1px solid #eee;
    }
}*/

h3 {
    font-size: 1.5em;
    line-height: 1.43;
}
h4 {
    font-size: 1.25em;
}
h5 {
    font-size: 1em;
}
h6 {
   font-size: 1em;
    color: #777;
}
p,
blockquote,
ul,
ol,
dl,
table{
    margin: 0.8em 0;
}
li>ol,
li>ul {
    margin: 0 0;
}
hr {
    height: 2px;
    padding: 0;
    margin: 16px 0;
    background-color: #e7e7e7;
    border: 0 none;
    overflow: hidden;
    box-sizing: content-box;
}

li p.first {
    display: inline-block;
}
ul,
ol {
    padding-left: 30px;
}
ul:first-child,
ol:first-child {
    margin-top: 0;
}
ul:last-child,
ol:last-child {
    margin-bottom: 0;
}
blockquote {
    border-left: 4px solid #dfe2e5;
    padding: 0 15px;
    color: #777777;
}
blockquote blockquote {
    padding-right: 0;
}
table {
    padding: 0;
    word-break: initial;
}
table tr {
    border: 1px solid #dfe2e5;
    margin: 0;
    padding: 0;
}
table tr:nth-child(2n),
thead {
    background-color: #f8f8f8;
}
table th {
    font-weight: bold;
    border: 1px solid #dfe2e5;
    border-bottom: 0;
    margin: 0;
    padding: 6px 13px;
}
table td {
    border: 1px solid #dfe2e5;
    margin: 0;
    padding: 6px 13px;
}
table th:first-child,
table td:first-child {
    margin-top: 0;
}
table th:last-child,
table td:last-child {
    margin-bottom: 0;
}

.CodeMirror-lines {
    padding-left: 4px;
}

.code-tooltip {
    box-shadow: 0 1px 1px 0 rgba(0,28,36,.3);
    border-top: 1px solid #eef2f2;
}

.md-fences,
code,
tt {
    border: 1px solid #e7eaed;
    background-color: #f8f8f8;
    border-radius: 3px;
    padding: 0;
    padding: 2px 4px 0px 4px;
    font-size: 0.9em;
}

code {
    background-color: #f3f4f4;
    padding: 0 2px 0 2px;
}

.md-fences {
    margin-bottom: 15px;
    margin-top: 15px;
    padding-top: 8px;
    padding-bottom: 6px;
}


.md-task-list-item > input {
  margin-left: -1.3em;
}

@media print {
    html {
        font-size: 13px;
    }
    pre {
        page-break-inside: avoid;
        word-wrap: break-word;
    }
}

.md-fences {
	background-color: #f8f8f8;
}
#write pre.md-meta-block {
	padding: 1rem;
    font-size: 85%;
    line-height: 1.45;
    background-color: #f7f7f7;
    border: 0;
    border-radius: 3px;
    color: #777777;
    margin-top: 0 !important;
}

.mathjax-block>.code-tooltip {
	bottom: .375rem;
}

.md-mathjax-midline {
    background: #fafafa;
}

#write>h3.md-focus:before{
	left: -1.5625rem;
	top: .375rem;
}
#write>h4.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
#write>h5.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
#write>h6.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
.md-image>.md-meta {
    /*border: 1px solid #ddd;*/
    border-radius: 3px;
    padding: 2px 0px 0px 4px;
    font-size: 0.9em;
    color: inherit;
}

.md-tag {
    color: #a7a7a7;
    opacity: 1;
}

.md-toc { 
    margin-top:20px;
    padding-bottom:20px;
}

.sidebar-tabs {
    border-bottom: none;
}

#typora-quick-open {
    border: 1px solid #ddd;
    background-color: #f8f8f8;
}

#typora-quick-open-item {
    background-color: #FAFAFA;
    border-color: #FEFEFE #e5e5e5 #e5e5e5 #eee;
    border-style: solid;
    border-width: 1px;
}

/** focus mode */
.on-focus-mode blockquote {
    border-left-color: rgba(85, 85, 85, 0.12);
}

header, .context-menu, .megamenu-content, footer{
    font-family: "Segoe UI", "Arial", sans-serif;
}

.file-node-content:hover .file-node-icon,
.file-node-content:hover .file-node-open-state{
    visibility: visible;
}

.mac-seamless-mode #typora-sidebar {
    background-color: #fafafa;
    background-color: var(--side-bar-bg-color);
}

.md-lang {
    color: #b4654d;
}

/*.html-for-mac {
    --item-hover-bg-color: #E6F0FE;
}*/

#md-notification .btn {
    border: 0;
}

.dropdown-menu .divider {
    border-color: #e5e5e5;
    opacity: 0.4;
}

.ty-preferences .window-content {
    background-color: #fafafa;
}

.ty-preferences .nav-group-item.active {
    color: white;
    background: #999;
}

.menu-item-container a.menu-style-btn {
    background-color: #f5f8fa;
    background-image: linear-gradient( 180deg , hsla(0, 0%, 100%, 0.8), hsla(0, 0%, 100%, 0)); 
}



mjx-container[jax="SVG"] {
  direction: ltr;
}

mjx-container[jax="SVG"] > svg {
  overflow: visible;
  min-height: 1px;
  min-width: 1px;
}

mjx-container[jax="SVG"] > svg a {
  fill: blue;
  stroke: blue;
}

mjx-assistive-mml {
  position: absolute !important;
  top: 0px;
  left: 0px;
  clip: rect(1px, 1px, 1px, 1px);
  padding: 1px 0px 0px 0px !important;
  border: 0px !important;
  display: block !important;
  width: auto !important;
  overflow: hidden !important;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

mjx-assistive-mml[display="block"] {
  width: 100% !important;
}

mjx-container[jax="SVG"][display="true"] {
  display: block;
  text-align: center;
  margin: 1em 0;
}

mjx-container[jax="SVG"][display="true"][width="full"] {
  display: flex;
}

mjx-container[jax="SVG"][justify="left"] {
  text-align: left;
}

mjx-container[jax="SVG"][justify="right"] {
  text-align: right;
}

g[data-mml-node="merror"] > g {
  fill: red;
  stroke: red;
}

g[data-mml-node="merror"] > rect[data-background] {
  fill: yellow;
  stroke: none;
}

g[data-mml-node="mtable"] > line[data-line], svg[data-table] > g > line[data-line] {
  stroke-width: 70px;
  fill: none;
}

g[data-mml-node="mtable"] > rect[data-frame], svg[data-table] > g > rect[data-frame] {
  stroke-width: 70px;
  fill: none;
}

g[data-mml-node="mtable"] > .mjx-dashed, svg[data-table] > g > .mjx-dashed {
  stroke-dasharray: 140;
}

g[data-mml-node="mtable"] > .mjx-dotted, svg[data-table] > g > .mjx-dotted {
  stroke-linecap: round;
  stroke-dasharray: 0,140;
}

g[data-mml-node="mtable"] > g > svg {
  overflow: visible;
}

[jax="SVG"] mjx-tool {
  display: inline-block;
  position: relative;
  width: 0;
  height: 0;
}

[jax="SVG"] mjx-tool > mjx-tip {
  position: absolute;
  top: 0;
  left: 0;
}

mjx-tool > mjx-tip {
  display: inline-block;
  padding: .2em;
  border: 1px solid #888;
  font-size: 70%;
  background-color: #F8F8F8;
  color: black;
  box-shadow: 2px 2px 5px #AAAAAA;
}

g[data-mml-node="maction"][data-toggle] {
  cursor: pointer;
}

mjx-status {
  display: block;
  position: fixed;
  left: 1em;
  bottom: 1em;
  min-width: 25%;
  padding: .2em .4em;
  border: 1px solid #888;
  font-size: 90%;
  background-color: #F8F8F8;
  color: black;
}

foreignObject[data-mjx-xml] {
  font-family: initial;
  line-height: normal;
  overflow: visible;
}

mjx-container[jax="SVG"] path[data-c], mjx-container[jax="SVG"] use[data-c] {
  stroke-width: 3;
}

g[data-mml-node="xypic"] path {
  stroke-width: inherit;
}

.MathJax g[data-mml-node="xypic"] path {
  stroke-width: inherit;
}
mjx-container[jax="SVG"] path[data-c], mjx-container[jax="SVG"] use[data-c] {
							stroke-width: 0;
						}
</style><title>README</title>
</head>
<body class='typora-export os-windows'><div class='typora-export-content'>
<div id='write'  class=''><h1 id='microchip数字电源开发工具介绍'><span>Microchip数字电源开发工具介绍</span></h1><p><span>Chao Wang</span></p><p><span>6/5/2022</span></p><blockquote><p><span style = "color:gray"><span>本文档为《数字电源开发工具》培训配套参考文档，主要用于指导Buck电路数字电源的软件工程创建，及相关开发、调试工具的使用，使大家对数字电源开发有个框架认识。</span></span></p></blockquote><h2 id='1-简介'><span>1. 简介</span></h2><p>&emsp;&emsp;<span>基于dsPIC® 数字信号控制器 (DSC) 开发数字电源时所涉及的主要开发工具如下。</span></p><p><span> </span>&emsp;&emsp;<span>1）MPLAB® PowerSmart™</span><br>
<span> </span>&emsp;&emsp;<span>该开发套件是一个软件套件，由多个可选组件组成，用于系统定义、系统建模、代码生成、控制系统微调和实时调试。</span></p><p><span> </span>&emsp;&emsp;<span>2）Power Board Visualizer</span><br>
<span> </span>&emsp;&emsp;<span>可配置的串口GUI，该GUI可与 dsPIC33 数字信号控制器 (DSC)实时交互数据，并将数据在GUI上可视化显示。</span></p><p><span> </span>&emsp;&emsp;<span>3）X2Cscope</span><br>
&emsp;&emsp;<span> 一种虚拟示波器工具，以 MPLAB ® X IDE 插件的形式存在，可在程序运行时实时查看、绘制甚至修改嵌入式程序中的任何全局变量，而无需停止 CPU。</span></p><p>&emsp;&emsp;<span>熟练、合理使用这些工具将加速您的电源设计过程。本文的目的主要是基于MPLAB® PowerSmart™ 快速构建一个电压模式控制的Buck电源，然后为其配套Power Board Visualizer上位机，并基于X2Cscope调试。</span></p><h2 id='2-开发环境'><span>2. 开发环境</span></h2><h3 id='21-软件开发环境'><span>2.1 软件开发环境</span></h3><p>&emsp;&emsp;<span>相关软件开发版本情况说明如下。</span></p><ul><li><a href='https://www.microchip.com/mplabx'><span>Microchip MPLAB® xIDE version 6.00 or newer</span></a></li><li><a href='https://www.microchip.com/en-us/development-tools-tools-and-software/mplab-xc-compilers'><span>Microchip MPLAB® XC16 C compiler version 2.00 or newer</span></a></li><li><a href='https://packs.download.microchip.com/'><span>Microchip dsPIC33CK-MP Series Device Support version 1.8.224 or newer</span></a></li><li><a href='https://www.microchip.com/en-us/development-tools-tools-and-software/embedded-software-center/mplab-code-configurator'><span>Microchip MPLAB® Code Configurator (MCC) version 5.1.9 or newer</span></a></li><li><a href='https://www.microchip.com/en-us/development-tools-tools-and-software/embedded-software-center/mplab-code-configurator'><span>MCC Library X2C-Scope 1.3.3 or newer</span></a></li><li><a href='https://www.microchip.com/en-us/solutions/power-management-and-conversion/intelligent-power/mplab-powersmart-development-suite'><span>MPLAB® PowerSmart™ Development Suite 1/31/2022 or newer</span></a></li></ul><h3 id='22-硬件开发环境'><span>2.2 硬件开发环境</span></h3><p>&emsp;&emsp;<span>该开发基于如下硬件平台。</span></p><ul><li><p><a href='https://www.microchip.com/en-us/development-tool/DM330017-3'><span>DSPIC33C DIGITAL POWER STARTER KIT (Part Number: DM330017-3)</span></a></p><p><img src="./images/3094-190117-mcu16-dm330017-3.jpg" referrerpolicy="no-referrer" alt="img"></p></li><li><p><a href='https://www.microchip.com/en-us/development-tool/DM330017-3'><span>MCP2200 BREAKOUT MODULE (Part Number: ADM00393)</span></a></p></li></ul><p><span class='md-image'><img src="./images/ADM00393.jpg"  align = "Center" width="20%"></span></p><h3 id='23-软硬件接口表'><span>2.3 软硬件接口表</span></h3><p>&emsp;&emsp;<span>软硬件接口表如下：</span></p><figure><table><thead><tr><th><span>DPSK Ⅲ 标号</span></th><th><span>MCP2200板标号</span></th><th><span>dsPIC引脚名称</span></th><th><span>功能</span></th></tr></thead><tbody><tr><td><span>RB14_PWM1H_BUCK</span></td><td>&nbsp;</td><td><span>RB14</span></td><td><span>Buck变换器上管驱动</span></td></tr><tr><td><span>RB15_PWM1L_BUCK</span></td><td>&nbsp;</td><td><span>RB15</span></td><td><span>Buck变换器下管驱动</span></td></tr><tr><td><span>RC1_OA3-_AN13_BUCK_VFB</span></td><td>&nbsp;</td><td><span>RC1</span></td><td><span>Buck变换器输出电压反馈 (Gain ≈ 0.5)</span></td></tr><tr><td><span>RC0_AN12_VIN_MEAS</span></td><td>&nbsp;</td><td><span>RC0</span></td><td><span>输入电压(Gain ≈ 0.125313)</span></td></tr><tr><td><span>RA0_AN0</span></td><td>&nbsp;</td><td><span>RA0</span></td><td><span>Buck变换器电感电流反馈 (Gain ≈ 1)</span></td></tr><tr><td><span>RC12_RP60_UART1_TX</span></td><td>&nbsp;</td><td><span>RC12</span></td><td><span>USB/串口通信发送管脚</span></td></tr><tr><td><span>RC13_RP61_UART1_RX</span></td><td>&nbsp;</td><td><span>RC13</span></td><td><span>USB/串口通信接收管脚</span></td></tr><tr><td><span>DSP_GPIO3</span></td><td><span>Serial排针 6管脚</span></td><td><span>RB11</span></td><td><span>TTL/串口通信发送管脚</span></td></tr><tr><td><span>DSP_GPIO4</span></td><td><span>Serial排针 1管脚</span></td><td><span>RB12</span></td><td><span>TTL/串口通信接收管脚</span></td></tr><tr><td><span>DSP_GPIO2</span></td><td>&nbsp;</td><td><span>RB6</span></td><td><span>LD5,用户可编程LED</span></td></tr></tbody></table></figure><p>&nbsp;</p><h2 id='3-软件工程创建'><span>3. 软件工程创建</span></h2><h3 id='31-工程创建'><span>3.1 工程创建</span></h3><ol start='' ><li><span>打开MPLAB® xIDE，选择&quot;File-&gt;New Project&quot;。</span></li></ol><p><img src="./images/1-0.png" width="100%"></p><ol start='2' ><li><span>选择&quot;Standalone Project&quot;，然后点击“Next“。</span></li></ol><p><img src="./images/1-1.png" width="100%"></p><ol start='3' ><li><span>器件型号选择dsPIC33CK256MP505，然后点击“Next“。</span></li></ol><p><img src="./images/1-2.png" width="100%"></p><ol start='4' ><li><span>XC16编译器选择当前最新的v2.00版本，然后点击“Next“。</span></li></ol><p><img src="./images/1-3.png" width="100%"></p><ol start='5' ><li><span>项目名称输入dpsk3_buck_voltage_mode，编码格式可选择UTF-8，然后点击“Finish“。</span></li></ol><p><img src="./images/1-4.png" width="100%"></p><ol start='6' ><li><span>在项目属性中核实下Packs，这里确定已选择最新的1.8.224，然后点击“Cancel”。</span></li></ol><p><img src="./images/1-5.png" width="100%"></p><h3 id='32-mcc设置'><span>3.2 MCC设置</span></h3><ol start='' ><li><span>打开MCC。</span></li></ol><p><img src="./images/2-0.png" width="100%"></p><ol start='2' ><li><span>弹出MCC Content Manager Wizard界面里点击“Select MCC Classic”。</span></li></ol><p><img src="./images/2-1.png" width="100%"></p><ol start='3' ><li><span>接着弹出的界面里点击“Finish”。</span></li></ol><p><img src="./images/2-2.png" width="100%"></p><ol start='4' ><li><span>点击上步的“Finish”后，等待一会将弹出如下MCC配置界面。</span></li></ol><p><img src="./images/2-3.png" width="100%"></p><ol start='5' ><li><span>在“System Module”界面下设置系统时钟。系统时钟输入选择内部的8MHz FRC振荡器，使能PLL以获得100MHz指令周期时钟</span><mjx-container class="MathJax" jax="SVG" style="position: relative;"><svg xmlns="http://www.w3.org/2000/svg" width="2.651ex" height="1.875ex" role="img" focusable="false" viewBox="0 -578 1171.9 828.7" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" style="vertical-align: -0.567ex;"><defs><path id="MJX-6-TEX-I-1D439" d="M48 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 659Q197 676 203 680H742Q749 676 749 669Q749 664 736 557T722 447Q720 440 702 440H690Q683 445 683 453Q683 454 686 477T689 530Q689 560 682 579T663 610T626 626T575 633T503 634H480Q398 633 393 631Q388 629 386 623Q385 622 352 492L320 363H375Q378 363 398 363T426 364T448 367T472 374T489 386Q502 398 511 419T524 457T529 475Q532 480 548 480H560Q567 475 567 470Q567 467 536 339T502 207Q500 200 482 200H470Q463 206 463 212Q463 215 468 234T473 274Q473 303 453 310T364 317H309L277 190Q245 66 245 60Q245 46 334 46H359Q365 40 365 39T363 19Q359 6 353 0H336Q295 2 185 2Q120 2 86 2T48 1Z"></path><path id="MJX-6-TEX-I-1D450" d="M34 159Q34 268 120 355T306 442Q362 442 394 418T427 355Q427 326 408 306T360 285Q341 285 330 295T319 325T330 359T352 380T366 386H367Q367 388 361 392T340 400T306 404Q276 404 249 390Q228 381 206 359Q162 315 142 235T121 119Q121 73 147 50Q169 26 205 26H209Q321 26 394 111Q403 121 406 121Q410 121 419 112T429 98T420 83T391 55T346 25T282 0T202 -11Q127 -11 81 37T34 159Z"></path><path id="MJX-6-TEX-I-1D466" d="M21 287Q21 301 36 335T84 406T158 442Q199 442 224 419T250 355Q248 336 247 334Q247 331 231 288T198 191T182 105Q182 62 196 45T238 27Q261 27 281 38T312 61T339 94Q339 95 344 114T358 173T377 247Q415 397 419 404Q432 431 462 431Q475 431 483 424T494 412T496 403Q496 390 447 193T391 -23Q363 -106 294 -155T156 -205Q111 -205 77 -183T43 -117Q43 -95 50 -80T69 -58T89 -48T106 -45Q150 -45 150 -87Q150 -107 138 -122T115 -142T102 -147L99 -148Q101 -153 118 -160T152 -167H160Q177 -167 186 -165Q219 -156 247 -127T290 -65T313 -9T321 21L315 17Q309 13 296 6T270 -6Q250 -11 231 -11Q185 -11 150 11T104 82Q103 89 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math"><g data-mml-node="mstyle" transform="scale(0.85)"><g data-mml-node="msub"><g data-mml-node="mi"><use data-c="1D439" xlink:href="#MJX-6-TEX-I-1D439"></use></g><g data-mml-node="TeXAtom" transform="translate(676,-150) scale(0.707)" data-mjx-texclass="ORD"><g data-mml-node="mi"><use data-c="1D450" xlink:href="#MJX-6-TEX-I-1D450"></use></g><g data-mml-node="mi" transform="translate(433,0)"><use data-c="1D466" xlink:href="#MJX-6-TEX-I-1D466"></use></g></g></g></g></g></g></svg><mjx-assistive-mml unselectable="on" display="inline"><math xmlns="http://www.w3.org/1998/Math/MathML"><mstyle mathsize="0.85em"><msub><mi>F</mi><mrow data-mjx-texclass="ORD"><mi>c</mi><mi>y</mi></mrow></msub></mstyle></math></mjx-assistive-mml></mjx-container><script type="math/tex">\small F_{cy}</script><span>；辅助时钟同样为内部的8MHz FRC振荡器作为时钟输入，经PLL后获得500MHz的</span><mjx-container class="MathJax" jax="SVG" style="position: relative;"><svg xmlns="http://www.w3.org/2000/svg" width="6.749ex" height="1.695ex" role="img" focusable="false" viewBox="0 -608.6 2983.2 749.3" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" style="vertical-align: -0.318ex;"><defs><path id="MJX-8-TEX-I-1D434" d="M208 74Q208 50 254 46Q272 46 272 35Q272 34 270 22Q267 8 264 4T251 0Q249 0 239 0T205 1T141 2Q70 2 50 0H42Q35 7 35 11Q37 38 48 46H62Q132 49 164 96Q170 102 345 401T523 704Q530 716 547 716H555H572Q578 707 578 706L606 383Q634 60 636 57Q641 46 701 46Q726 46 726 36Q726 34 723 22Q720 7 718 4T704 0Q701 0 690 0T651 1T578 2Q484 2 455 0H443Q437 6 437 9T439 27Q443 40 445 43L449 46H469Q523 49 533 63L521 213H283L249 155Q208 86 208 74ZM516 260Q516 271 504 416T490 562L463 519Q447 492 400 412L310 260L413 259Q516 259 516 260Z"></path><path id="MJX-8-TEX-I-1D439" d="M48 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 659Q197 676 203 680H742Q749 676 749 669Q749 664 736 557T722 447Q720 440 702 440H690Q683 445 683 453Q683 454 686 477T689 530Q689 560 682 579T663 610T626 626T575 633T503 634H480Q398 633 393 631Q388 629 386 623Q385 622 352 492L320 363H375Q378 363 398 363T426 364T448 367T472 374T489 386Q502 398 511 419T524 457T529 475Q532 480 548 480H560Q567 475 567 470Q567 467 536 339T502 207Q500 200 482 200H470Q463 206 463 212Q463 215 468 234T473 274Q473 303 453 310T364 317H309L277 190Q245 66 245 60Q245 46 334 46H359Q365 40 365 39T363 19Q359 6 353 0H336Q295 2 185 2Q120 2 86 2T48 1Z"></path><path id="MJX-8-TEX-I-1D443" d="M287 628Q287 635 230 637Q206 637 199 638T192 648Q192 649 194 659Q200 679 203 681T397 683Q587 682 600 680Q664 669 707 631T751 530Q751 453 685 389Q616 321 507 303Q500 302 402 301H307L277 182Q247 66 247 59Q247 55 248 54T255 50T272 48T305 46H336Q342 37 342 35Q342 19 335 5Q330 0 319 0Q316 0 282 1T182 2Q120 2 87 2T51 1Q33 1 33 11Q33 13 36 25Q40 41 44 43T67 46Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628ZM645 554Q645 567 643 575T634 597T609 619T560 635Q553 636 480 637Q463 637 445 637T416 636T404 636Q391 635 386 627Q384 621 367 550T332 412T314 344Q314 342 395 342H407H430Q542 342 590 392Q617 419 631 471T645 554Z"></path><path id="MJX-8-TEX-I-1D43F" d="M228 637Q194 637 192 641Q191 643 191 649Q191 673 202 682Q204 683 217 683Q271 680 344 680Q485 680 506 683H518Q524 677 524 674T522 656Q517 641 513 637H475Q406 636 394 628Q387 624 380 600T313 336Q297 271 279 198T252 88L243 52Q243 48 252 48T311 46H328Q360 46 379 47T428 54T478 72T522 106T564 161Q580 191 594 228T611 270Q616 273 628 273H641Q647 264 647 262T627 203T583 83T557 9Q555 4 553 3T537 0T494 -1Q483 -1 418 -1T294 0H116Q32 0 32 10Q32 17 34 24Q39 43 44 45Q48 46 59 46H65Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628Q285 635 228 637Z"></path><path id="MJX-8-TEX-I-1D442" d="M740 435Q740 320 676 213T511 42T304 -22Q207 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435ZM637 476Q637 565 591 615T476 665Q396 665 322 605Q242 542 200 428T157 216Q157 126 200 73T314 19Q404 19 485 98T608 313Q637 408 637 476Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math"><g data-mml-node="mstyle" transform="scale(0.85)"><g data-mml-node="mi"><use data-c="1D434" xlink:href="#MJX-8-TEX-I-1D434"></use></g><g data-mml-node="msub" transform="translate(750,0)"><g data-mml-node="mi"><use data-c="1D439" xlink:href="#MJX-8-TEX-I-1D439"></use></g><g data-mml-node="TeXAtom" transform="translate(676,-150) scale(0.707)" data-mjx-texclass="ORD"><g data-mml-node="mi"><use data-c="1D443" xlink:href="#MJX-8-TEX-I-1D443"></use></g><g data-mml-node="mi" transform="translate(751,0)"><use data-c="1D43F" xlink:href="#MJX-8-TEX-I-1D43F"></use></g><g data-mml-node="mi" transform="translate(1432,0)"><use data-c="1D43F" xlink:href="#MJX-8-TEX-I-1D43F"></use></g><g data-mml-node="mi" transform="translate(2113,0)"><use data-c="1D442" xlink:href="#MJX-8-TEX-I-1D442"></use></g></g></g></g></g></g></svg><mjx-assistive-mml unselectable="on" display="inline"><math xmlns="http://www.w3.org/1998/Math/MathML"><mstyle mathsize="0.85em"><mi>A</mi><msub><mi>F</mi><mrow data-mjx-texclass="ORD"><mi>P</mi><mi>L</mi><mi>L</mi><mi>O</mi></mrow></msub></mstyle></math></mjx-assistive-mml></mjx-container><script type="math/tex">\small AF_{PLLO}</script><span>。</span></li></ol><p><img src="./images/2-4.png" width="100%"></p><ol start='6' ><li><span>在器件资源列表里找到PWM，如下图所示，然后单击红框中的“+”。</span></li></ol><p><img src="./images/2-5.png" width="100%"></p><ol start='7' ><li><span>经如上步骤后可以打开PWM配置界面，时钟源选择</span><mjx-container class="MathJax" jax="SVG" style="position: relative;"><svg xmlns="http://www.w3.org/2000/svg" width="6.749ex" height="1.695ex" role="img" focusable="false" viewBox="0 -608.6 2983.2 749.3" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" style="vertical-align: -0.318ex;"><defs><path id="MJX-8-TEX-I-1D434" d="M208 74Q208 50 254 46Q272 46 272 35Q272 34 270 22Q267 8 264 4T251 0Q249 0 239 0T205 1T141 2Q70 2 50 0H42Q35 7 35 11Q37 38 48 46H62Q132 49 164 96Q170 102 345 401T523 704Q530 716 547 716H555H572Q578 707 578 706L606 383Q634 60 636 57Q641 46 701 46Q726 46 726 36Q726 34 723 22Q720 7 718 4T704 0Q701 0 690 0T651 1T578 2Q484 2 455 0H443Q437 6 437 9T439 27Q443 40 445 43L449 46H469Q523 49 533 63L521 213H283L249 155Q208 86 208 74ZM516 260Q516 271 504 416T490 562L463 519Q447 492 400 412L310 260L413 259Q516 259 516 260Z"></path><path id="MJX-8-TEX-I-1D439" d="M48 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 659Q197 676 203 680H742Q749 676 749 669Q749 664 736 557T722 447Q720 440 702 440H690Q683 445 683 453Q683 454 686 477T689 530Q689 560 682 579T663 610T626 626T575 633T503 634H480Q398 633 393 631Q388 629 386 623Q385 622 352 492L320 363H375Q378 363 398 363T426 364T448 367T472 374T489 386Q502 398 511 419T524 457T529 475Q532 480 548 480H560Q567 475 567 470Q567 467 536 339T502 207Q500 200 482 200H470Q463 206 463 212Q463 215 468 234T473 274Q473 303 453 310T364 317H309L277 190Q245 66 245 60Q245 46 334 46H359Q365 40 365 39T363 19Q359 6 353 0H336Q295 2 185 2Q120 2 86 2T48 1Z"></path><path id="MJX-8-TEX-I-1D443" d="M287 628Q287 635 230 637Q206 637 199 638T192 648Q192 649 194 659Q200 679 203 681T397 683Q587 682 600 680Q664 669 707 631T751 530Q751 453 685 389Q616 321 507 303Q500 302 402 301H307L277 182Q247 66 247 59Q247 55 248 54T255 50T272 48T305 46H336Q342 37 342 35Q342 19 335 5Q330 0 319 0Q316 0 282 1T182 2Q120 2 87 2T51 1Q33 1 33 11Q33 13 36 25Q40 41 44 43T67 46Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628ZM645 554Q645 567 643 575T634 597T609 619T560 635Q553 636 480 637Q463 637 445 637T416 636T404 636Q391 635 386 627Q384 621 367 550T332 412T314 344Q314 342 395 342H407H430Q542 342 590 392Q617 419 631 471T645 554Z"></path><path id="MJX-8-TEX-I-1D43F" d="M228 637Q194 637 192 641Q191 643 191 649Q191 673 202 682Q204 683 217 683Q271 680 344 680Q485 680 506 683H518Q524 677 524 674T522 656Q517 641 513 637H475Q406 636 394 628Q387 624 380 600T313 336Q297 271 279 198T252 88L243 52Q243 48 252 48T311 46H328Q360 46 379 47T428 54T478 72T522 106T564 161Q580 191 594 228T611 270Q616 273 628 273H641Q647 264 647 262T627 203T583 83T557 9Q555 4 553 3T537 0T494 -1Q483 -1 418 -1T294 0H116Q32 0 32 10Q32 17 34 24Q39 43 44 45Q48 46 59 46H65Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628Q285 635 228 637Z"></path><path id="MJX-8-TEX-I-1D442" d="M740 435Q740 320 676 213T511 42T304 -22Q207 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435ZM637 476Q637 565 591 615T476 665Q396 665 322 605Q242 542 200 428T157 216Q157 126 200 73T314 19Q404 19 485 98T608 313Q637 408 637 476Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math"><g data-mml-node="mstyle" transform="scale(0.85)"><g data-mml-node="mi"><use data-c="1D434" xlink:href="#MJX-8-TEX-I-1D434"></use></g><g data-mml-node="msub" transform="translate(750,0)"><g data-mml-node="mi"><use data-c="1D439" xlink:href="#MJX-8-TEX-I-1D439"></use></g><g data-mml-node="TeXAtom" transform="translate(676,-150) scale(0.707)" data-mjx-texclass="ORD"><g data-mml-node="mi"><use data-c="1D443" xlink:href="#MJX-8-TEX-I-1D443"></use></g><g data-mml-node="mi" transform="translate(751,0)"><use data-c="1D43F" xlink:href="#MJX-8-TEX-I-1D43F"></use></g><g data-mml-node="mi" transform="translate(1432,0)"><use data-c="1D43F" xlink:href="#MJX-8-TEX-I-1D43F"></use></g><g data-mml-node="mi" transform="translate(2113,0)"><use data-c="1D442" xlink:href="#MJX-8-TEX-I-1D442"></use></g></g></g></g></g></g></svg><mjx-assistive-mml unselectable="on" display="inline"><math xmlns="http://www.w3.org/1998/Math/MathML"><mstyle mathsize="0.85em"><mi>A</mi><msub><mi>F</mi><mrow data-mjx-texclass="ORD"><mi>P</mi><mi>L</mi><mi>L</mi><mi>O</mi></mrow></msub></mstyle></math></mjx-assistive-mml></mjx-container><script type="math/tex">\small AF_{PLLO}</script><span>，使能高精度，PWM模式选择默认独立边沿模式，输出模式选择默认互补模式，PWM频率设置为所需的500kHz。</span></li></ol><p><img src="./images/2-7.png" width="100%"></p><ol start='8' ><li><span>接着配置ADC Trigger，ADC Trigger1设置为Trigger A Compare, ADC Trigger2设置为Trigger B Compare。上升沿死区20ns，下降沿死区60ns。缓冲寄存器更新模式选择手动更新，在下一周期开始时刻更新。</span></li></ol><p><img src="./images/2-8.png" width="100%"></p><ol start='9' ><li><span>同理双击加号，添加ADC。</span></li></ol><p><img src="./images/2-9.png" width="100%"></p><ol start='10' ><li><span>在Easy Setup界面进行ADC设置，先设置时钟源，选择</span><mjx-container class="MathJax" jax="SVG" style="position: relative;"><svg xmlns="http://www.w3.org/2000/svg" width="6.069ex" height="2.467ex" role="img" focusable="false" viewBox="0 -797.2 2682.5 1090.5" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" style="vertical-align: -0.663ex;"><defs><path id="MJX-9-TEX-I-1D439" d="M48 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 659Q197 676 203 680H742Q749 676 749 669Q749 664 736 557T722 447Q720 440 702 440H690Q683 445 683 453Q683 454 686 477T689 530Q689 560 682 579T663 610T626 626T575 633T503 634H480Q398 633 393 631Q388 629 386 623Q385 622 352 492L320 363H375Q378 363 398 363T426 364T448 367T472 374T489 386Q502 398 511 419T524 457T529 475Q532 480 548 480H560Q567 475 567 470Q567 467 536 339T502 207Q500 200 482 200H470Q463 206 463 212Q463 215 468 234T473 274Q473 303 453 310T364 317H309L277 190Q245 66 245 60Q245 46 334 46H359Q365 40 365 39T363 19Q359 6 353 0H336Q295 2 185 2Q120 2 86 2T48 1Z"></path><path id="MJX-9-TEX-I-1D443" d="M287 628Q287 635 230 637Q206 637 199 638T192 648Q192 649 194 659Q200 679 203 681T397 683Q587 682 600 680Q664 669 707 631T751 530Q751 453 685 389Q616 321 507 303Q500 302 402 301H307L277 182Q247 66 247 59Q247 55 248 54T255 50T272 48T305 46H336Q342 37 342 35Q342 19 335 5Q330 0 319 0Q316 0 282 1T182 2Q120 2 87 2T51 1Q33 1 33 11Q33 13 36 25Q40 41 44 43T67 46Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628ZM645 554Q645 567 643 575T634 597T609 619T560 635Q553 636 480 637Q463 637 445 637T416 636T404 636Q391 635 386 627Q384 621 367 550T332 412T314 344Q314 342 395 342H407H430Q542 342 590 392Q617 419 631 471T645 554Z"></path><path id="MJX-9-TEX-I-1D43F" d="M228 637Q194 637 192 641Q191 643 191 649Q191 673 202 682Q204 683 217 683Q271 680 344 680Q485 680 506 683H518Q524 677 524 674T522 656Q517 641 513 637H475Q406 636 394 628Q387 624 380 600T313 336Q297 271 279 198T252 88L243 52Q243 48 252 48T311 46H328Q360 46 379 47T428 54T478 72T522 106T564 161Q580 191 594 228T611 270Q616 273 628 273H641Q647 264 647 262T627 203T583 83T557 9Q555 4 553 3T537 0T494 -1Q483 -1 418 -1T294 0H116Q32 0 32 10Q32 17 34 24Q39 43 44 45Q48 46 59 46H65Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628Q285 635 228 637Z"></path><path id="MJX-9-TEX-I-1D449" d="M52 648Q52 670 65 683H76Q118 680 181 680Q299 680 320 683H330Q336 677 336 674T334 656Q329 641 325 637H304Q282 635 274 635Q245 630 242 620Q242 618 271 369T301 118L374 235Q447 352 520 471T595 594Q599 601 599 609Q599 633 555 637Q537 637 537 648Q537 649 539 661Q542 675 545 679T558 683Q560 683 570 683T604 682T668 681Q737 681 755 683H762Q769 676 769 672Q769 655 760 640Q757 637 743 637Q730 636 719 635T698 630T682 623T670 615T660 608T652 599T645 592L452 282Q272 -9 266 -16Q263 -18 259 -21L241 -22H234Q216 -22 216 -15Q213 -9 177 305Q139 623 138 626Q133 637 76 637H59Q52 642 52 648Z"></path><path id="MJX-9-TEX-I-1D436" d="M50 252Q50 367 117 473T286 641T490 704Q580 704 633 653Q642 643 648 636T656 626L657 623Q660 623 684 649Q691 655 699 663T715 679T725 690L740 705H746Q760 705 760 698Q760 694 728 561Q692 422 692 421Q690 416 687 415T669 413H653Q647 419 647 422Q647 423 648 429T650 449T651 481Q651 552 619 605T510 659Q484 659 454 652T382 628T299 572T226 479Q194 422 175 346T156 222Q156 108 232 58Q280 24 350 24Q441 24 512 92T606 240Q610 253 612 255T628 257Q648 257 648 248Q648 243 647 239Q618 132 523 55T319 -22Q206 -22 128 53T50 252Z"></path><path id="MJX-9-TEX-I-1D442" d="M740 435Q740 320 676 213T511 42T304 -22Q207 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435ZM637 476Q637 565 591 615T476 665Q396 665 322 605Q242 542 200 428T157 216Q157 126 200 73T314 19Q404 19 485 98T608 313Q637 408 637 476Z"></path><path id="MJX-9-TEX-N-34" d="M462 0Q444 3 333 3Q217 3 199 0H190V46H221Q241 46 248 46T265 48T279 53T286 61Q287 63 287 115V165H28V211L179 442Q332 674 334 675Q336 677 355 677H373L379 671V211H471V165H379V114Q379 73 379 66T385 54Q393 47 442 46H471V0H462ZM293 211V545L74 212L183 211H293Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math"><g data-mml-node="mstyle" transform="scale(0.85)"><g data-mml-node="mfrac"><g data-mml-node="msub" transform="translate(220,457.1) scale(0.707)"><g data-mml-node="mi"><use data-c="1D439" xlink:href="#MJX-9-TEX-I-1D439"></use></g><g data-mml-node="TeXAtom" transform="translate(676,-150) scale(0.707)" data-mjx-texclass="ORD"><g data-mml-node="mi"><use data-c="1D443" xlink:href="#MJX-9-TEX-I-1D443"></use></g><g data-mml-node="mi" transform="translate(751,0)"><use data-c="1D43F" xlink:href="#MJX-9-TEX-I-1D43F"></use></g><g data-mml-node="mi" transform="translate(1432,0)"><use data-c="1D43F" xlink:href="#MJX-9-TEX-I-1D43F"></use></g><g data-mml-node="mi" transform="translate(2113,0)"><use data-c="1D449" xlink:href="#MJX-9-TEX-I-1D449"></use></g><g data-mml-node="mi" transform="translate(2882,0)"><use data-c="1D436" xlink:href="#MJX-9-TEX-I-1D436"></use></g><g data-mml-node="mi" transform="translate(3642,0)"><use data-c="1D442" xlink:href="#MJX-9-TEX-I-1D442"></use></g></g></g><g data-mml-node="mn" transform="translate(1401.2,-345) scale(0.707)"><use data-c="34" xlink:href="#MJX-9-TEX-N-34"></use></g><rect width="2915.9" height="60" x="120" y="220"></rect></g></g></g></g></svg><mjx-assistive-mml unselectable="on" display="inline"><math xmlns="http://www.w3.org/1998/Math/MathML"><mstyle mathsize="0.85em"><mfrac><msub><mi>F</mi><mrow data-mjx-texclass="ORD"><mi>P</mi><mi>L</mi><mi>L</mi><mi>V</mi><mi>C</mi><mi>O</mi></mrow></msub><mn>4</mn></mfrac></mstyle></math></mjx-assistive-mml></mjx-container><script type="math/tex">\small \frac{F_{PLLVCO}}{4}</script><span>。注意此时有个14.3ns的告警，在下一步Registers界面进一步设置后该告警将消失。</span></li></ol><p><img src="./images/2-10.png" width="100%"></p><ol start='11' ><li><span>在registers界面下进行分频比设置，分频比选择3分频，这样会将ADC core的时钟设置为400M/3/2Hz。设置完后点击Easy setup，回到Easy setup界面对采样通道设置。</span></li></ol><p><img src="./images/2-11.png" width="100%"></p><ol start='12' ><li><span>在Easy setup界面设置采样通道，AN0为电感电流采样通道，触发信号选择PWM1 Trigger2；AN12为输入电压采样，触发信号为PWM1 Trigger1；AN13为输出电压采样，触发信号为PWM1 Trigger1，并且开启该通道ADC转换完成中断。</span></li></ol><p><img src="./images/2-12.png" width="100%"></p><ol start='13' ><li><span>AN12和AN13使用共享ADC core，因此可在两个通道转换之间适当添加采样时间，这里设置为6 </span><mjx-container class="MathJax" jax="SVG" style="position: relative;"><svg xmlns="http://www.w3.org/2000/svg" width="7.571ex" height="1.625ex" role="img" focusable="false" viewBox="0 -575.5 3346.2 718.5" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" style="vertical-align: -0.324ex;"><defs><path id="MJX-10-TEX-I-1D447" d="M40 437Q21 437 21 445Q21 450 37 501T71 602L88 651Q93 669 101 677H569H659Q691 677 697 676T704 667Q704 661 687 553T668 444Q668 437 649 437Q640 437 637 437T631 442L629 445Q629 451 635 490T641 551Q641 586 628 604T573 629Q568 630 515 631Q469 631 457 630T439 622Q438 621 368 343T298 60Q298 48 386 46Q418 46 427 45T436 36Q436 31 433 22Q429 4 424 1L422 0Q419 0 415 0Q410 0 363 1T228 2Q99 2 64 0H49Q43 6 43 9T45 27Q49 40 55 46H83H94Q174 46 189 55Q190 56 191 56Q196 59 201 76T241 233Q258 301 269 344Q339 619 339 625Q339 630 310 630H279Q212 630 191 624Q146 614 121 583T67 467Q60 445 57 441T43 437H40Z"></path><path id="MJX-10-TEX-I-1D434" d="M208 74Q208 50 254 46Q272 46 272 35Q272 34 270 22Q267 8 264 4T251 0Q249 0 239 0T205 1T141 2Q70 2 50 0H42Q35 7 35 11Q37 38 48 46H62Q132 49 164 96Q170 102 345 401T523 704Q530 716 547 716H555H572Q578 707 578 706L606 383Q634 60 636 57Q641 46 701 46Q726 46 726 36Q726 34 723 22Q720 7 718 4T704 0Q701 0 690 0T651 1T578 2Q484 2 455 0H443Q437 6 437 9T439 27Q443 40 445 43L449 46H469Q523 49 533 63L521 213H283L249 155Q208 86 208 74ZM516 260Q516 271 504 416T490 562L463 519Q447 492 400 412L310 260L413 259Q516 259 516 260Z"></path><path id="MJX-10-TEX-I-1D437" d="M287 628Q287 635 230 637Q207 637 200 638T193 647Q193 655 197 667T204 682Q206 683 403 683Q570 682 590 682T630 676Q702 659 752 597T803 431Q803 275 696 151T444 3L430 1L236 0H125H72Q48 0 41 2T33 11Q33 13 36 25Q40 41 44 43T67 46Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628ZM703 469Q703 507 692 537T666 584T629 613T590 629T555 636Q553 636 541 636T512 636T479 637H436Q392 637 386 627Q384 623 313 339T242 52Q242 48 253 48T330 47Q335 47 349 47T373 46Q499 46 581 128Q617 164 640 212T683 339T703 469Z"></path><path id="MJX-10-TEX-I-1D436" d="M50 252Q50 367 117 473T286 641T490 704Q580 704 633 653Q642 643 648 636T656 626L657 623Q660 623 684 649Q691 655 699 663T715 679T725 690L740 705H746Q760 705 760 698Q760 694 728 561Q692 422 692 421Q690 416 687 415T669 413H653Q647 419 647 422Q647 423 648 429T650 449T651 481Q651 552 619 605T510 659Q484 659 454 652T382 628T299 572T226 479Q194 422 175 346T156 222Q156 108 232 58Q280 24 350 24Q441 24 512 92T606 240Q610 253 612 255T628 257Q648 257 648 248Q648 243 647 239Q618 132 523 55T319 -22Q206 -22 128 53T50 252Z"></path><path id="MJX-10-TEX-I-1D442" d="M740 435Q740 320 676 213T511 42T304 -22Q207 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435ZM637 476Q637 565 591 615T476 665Q396 665 322 605Q242 542 200 428T157 216Q157 126 200 73T314 19Q404 19 485 98T608 313Q637 408 637 476Z"></path><path id="MJX-10-TEX-I-1D445" d="M230 637Q203 637 198 638T193 649Q193 676 204 682Q206 683 378 683Q550 682 564 680Q620 672 658 652T712 606T733 563T739 529Q739 484 710 445T643 385T576 351T538 338L545 333Q612 295 612 223Q612 212 607 162T602 80V71Q602 53 603 43T614 25T640 16Q668 16 686 38T712 85Q717 99 720 102T735 105Q755 105 755 93Q755 75 731 36Q693 -21 641 -21H632Q571 -21 531 4T487 82Q487 109 502 166T517 239Q517 290 474 313Q459 320 449 321T378 323H309L277 193Q244 61 244 59Q244 55 245 54T252 50T269 48T302 46H333Q339 38 339 37T336 19Q332 6 326 0H311Q275 2 180 2Q146 2 117 2T71 2T50 1Q33 1 33 10Q33 12 36 24Q41 43 46 45Q50 46 61 46H67Q94 46 127 49Q141 52 146 61Q149 65 218 339T287 628Q287 635 230 637ZM630 554Q630 586 609 608T523 636Q521 636 500 636T462 637H440Q393 637 386 627Q385 624 352 494T319 361Q319 360 388 360Q466 361 492 367Q556 377 592 426Q608 449 619 486T630 554Z"></path><path id="MJX-10-TEX-I-1D438" d="M492 213Q472 213 472 226Q472 230 477 250T482 285Q482 316 461 323T364 330H312Q311 328 277 192T243 52Q243 48 254 48T334 46Q428 46 458 48T518 61Q567 77 599 117T670 248Q680 270 683 272Q690 274 698 274Q718 274 718 261Q613 7 608 2Q605 0 322 0H133Q31 0 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q146 66 215 342T285 622Q285 629 281 629Q273 632 228 634H197Q191 640 191 642T193 659Q197 676 203 680H757Q764 676 764 669Q764 664 751 557T737 447Q735 440 717 440H705Q698 445 698 453L701 476Q704 500 704 528Q704 558 697 578T678 609T643 625T596 632T532 634H485Q397 633 392 631Q388 629 386 622Q385 619 355 499T324 377Q347 376 372 376H398Q464 376 489 391T534 472Q538 488 540 490T557 493Q562 493 565 493T570 492T572 491T574 487T577 483L544 351Q511 218 508 216Q505 213 492 213Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math"><g data-mml-node="mstyle" transform="scale(0.85)"><g data-mml-node="msub"><g data-mml-node="mi"><use data-c="1D447" xlink:href="#MJX-10-TEX-I-1D447"></use></g><g data-mml-node="TeXAtom" transform="translate(617,-152.7) scale(0.707)" data-mjx-texclass="ORD"><g data-mml-node="mi"><use data-c="1D434" xlink:href="#MJX-10-TEX-I-1D434"></use></g><g data-mml-node="mi" transform="translate(750,0)"><use data-c="1D437" xlink:href="#MJX-10-TEX-I-1D437"></use></g><g data-mml-node="mi" transform="translate(1578,0)"><use data-c="1D436" xlink:href="#MJX-10-TEX-I-1D436"></use></g><g data-mml-node="mi" transform="translate(2338,0)"><use data-c="1D442" xlink:href="#MJX-10-TEX-I-1D442"></use></g><g data-mml-node="mi" transform="translate(3101,0)"><use data-c="1D445" xlink:href="#MJX-10-TEX-I-1D445"></use></g><g data-mml-node="mi" transform="translate(3860,0)"><use data-c="1D438" xlink:href="#MJX-10-TEX-I-1D438"></use></g></g></g></g></g></g></svg><mjx-assistive-mml unselectable="on" display="inline"><math xmlns="http://www.w3.org/1998/Math/MathML"><mstyle mathsize="0.85em"><msub><mi>T</mi><mrow data-mjx-texclass="ORD"><mi>A</mi><mi>D</mi><mi>C</mi><mi>O</mi><mi>R</mi><mi>E</mi></mrow></msub></mstyle></math></mjx-assistive-mml></mjx-container><script type="math/tex">\small T_{ADCORE}</script><span>。</span></li></ol><p><img src="./images/2-12-1.png" width="100%"></p><ol start='14' ><li><span>同样添加Timer外设，对Timer设置如下。</span></li></ol><p><img src="./images/2-14.png" width="100%"></p><ol start='15' ><li><span>添加UART1用于串口和上位机通讯，设置如下。</span></li></ol><p><img src="./images/2-16.png" width="100%"></p><ol start='16' ><li><span>同样添加UART2，用于软件示波器，设置如下。</span></li></ol><p><img src="./images/2-18.png" width="100%"></p><ol start='17' ><li><span>相关pin脚根据软硬件接口资源分配按如下设置。</span></li></ol><p><img src="./images/2-19.png" width="100%"></p><ol start='18' ><li><span>中断的设置，全局中断禁止，后续在软件中开启。AN13中断优先级提高到较高优先级，这里选择优先级6，并且开启自动上下文切换，这里选择CTXT1。</span></li></ol><p><img src="./images/2-20.png" width="100%"></p><ol start='19' ><li><span>Timer的中断仍维持低优先级，这个没有更改，是默认的。</span></li></ol><p><img src="./images/2-21.png" width="100%"></p><ol start='20' ><li><span>到目前为止，所有需MCC配置的部分全部完成，点击“Generate”生成代码，“output”窗口有生成过程提示，代码生成结束可点击MCC图标关闭MCC。</span></li></ol><p><img src="./images/2-22.png" width="100%"></p><h3 id='33-powersmart™设置'><span>3.3 PowerSmart™设置</span></h3><ol start='' ><li><span>在用PowerSmart™进行数字控制器开发之前，我们可以对软件工程目录添加如下空文件夹，power_control/config文件夹用于存放PowerSmart™的配置文件，power_control/drivers文件夹用于存放PowerSmart™生成的代码。并将项目属性中的C 和ASM include dirs添加app\power_control\drivers，这样对PowerSmart™生成代码的头文件包含有所帮助。</span></li></ol><p><img src="./images/3-0.png" width="100%"></p><ol start='2' ><li><span>打开PowerSmart™软件，选择MPLAB® X Project，这里选择刚刚建立的工程dpsk3_buck_voltage_mode.X\nbproject目录下的project文件。然后C 和Assembler include Path设置为app\power_control\drivers。</span></li></ol><p><img src="./images/3-1.png" width="100%"></p><ol start='3' ><li><span>本次我们实现buck的电压环模式，所以单击下图的VMC模式，然后点击向上箭头即可添加控制方法。</span></li></ol><p><img src="./images/3-2.png" width="100%"></p><ol start='4' ><li><span>后续我们可以基于PowerSmart™进行环路分析，所以这里先按如下步骤导入被控对象的bode图数据。</span></li></ol><p><img src="./images/3-3.png" width="100%"></p><ol start='5' ><li><span>选择被控对象bode图数据，然后倒入数据。</span></li></ol><p><img src="./images/3-2-1.png" width="100%"></p><ol start='6' ><li><span>点击如下红框电压环路控制器，打开DCLD（Digital Control Library Designer）。</span></li></ol><p><img src="./images/3-4.png" width="100%"></p><ol start='7' ><li><span>控制器的名字根据习惯命名，这里取为v_loop，接着对反馈环节进行设置，并标幺化输入增益。同时根据上面导入的被控对象特性设置控制器零极点参数。</span></li></ol><p><img src="./images/3-5.png" width="100%"></p><ol start='8' ><li><span>回到PowerSmart™ Bode图界面，可以看到在如上控制器参数下相位裕度有60°，直观评估在该控制器设计下系统是可以稳定工作的。</span></li></ol><p><img src="./images/3-7.png" width="100%"></p><ol start='9' ><li><span>回到DCLD配置界面，软件上下文管理需要关闭，因为AN13的采样中断开启了自动上下文处理。同时添加ADC Trigger B的自动加载，为了AN0采集电感电流的中点。</span></li></ol><p><img src="./images/3-6.png" width="100%"></p><ol start='10' ><li><span>代码生成并导入到指定目录，如下Edit Configuration用于设置代码生成目录。</span></li></ol><p><img src="./images/3-8.png" width="100%"></p><ol start='11' ><li><span>DCLD配置保存。</span></li></ol><p><img src="./images/3-9.png" width="100%"></p><ol start='12' ><li><span>PowerSmart™配置保存。</span></li></ol><p><img src="./images/3-10.png" width="100%"></p><ol start='13' ><li><span>PowerSmart™的配置文件可以添加到如下位置，这样下次可以用右键Open in System打开。</span></li></ol><p><img src="./images/3-12.png" width="100%"></p><h3 id='34-软件编码'><span>3.4 软件编码</span></h3><ol start='' ><li><span>将PowerSmart™生成的代码、以及准备好的gui代码、X2CScope的代码和库添加到工程中。</span></li></ol><p><img src="./images/4-0.png" width="100%"></p><ol start='2' ><li><span>用事先准备的main.c替换原有MCC生成的main.c，之后对工程进行编译，可成功编译。</span></li></ol><p><img src="./images/4-1.png" width="100%"></p><h2 id='4-实验验证'><span>4. 实验验证</span></h2><h3 id='41-led闪烁'><span>4.1 LED闪烁</span></h3><p>&emsp;&emsp;<span>USB连接dpsk3 demo板，点击下载按钮并选择板上编程器，即可完成程序下载，程序下载成功后LD5会1Hz频率闪烁。</span></p><p><img src="./images/4-2.png" width="100%"></p><h3 id='42-gui上位机通讯'><span>4.2 GUI上位机通讯</span></h3><p>&emsp;&emsp;<span>dpsk3接9V电源后buck会自动开机，输出电压3.3V，此时打开MICROCHIP POWER BOARD VISUALIZER, 打开预先配置的如下目录下XML文件以加载界面。</span></p><p><img src="./images/5-0.png" width="100%"></p><p>&emsp;&emsp;<span>界面打开后COM口根据实际情况选择，这里选择COM4，波特率115200。设置好COM口后点击Enable开始通讯。相关通信界面如下图，用户可以自己尝试操作。同时界面也是用户可以自定义配置的，详见帮助文档参考资料[2]。</span></p><p><img src="./images/5-1.png" width="100%"></p><p><img src="./images/5-2.png" width="100%"></p><p><img src="./images/5-3.png" width="100%"></p><p><img src="./images/5-4.png" width="100%"></p><p><img src="./images/5-5.png" width="100%"></p><p><img src="./images/5-6.png" width="100%"></p><p><img src="./images/5-7.png" width="100%"></p><h4 id='43-x2cscope软件示波器'><span>4.3 X2CScope软件示波器</span></h4><p>&emsp;&emsp;<span>为了运行X2CScope，首先需要修改项目属性，勾选加载symbols选项，然后点击OK。之后再次编译下载工程。</span></p><p><img src="./images/6-1.png" width="100%"></p><p>&emsp;&emsp;<span>打开X2CScope插件。</span></p><p><img src="./images/6-2.png" width="100%"></p><p>&emsp;&emsp;<span>选择当前工程，选择串口，设置波特率460800，然后点击红框建立连接。</span></p><p><img src="./images/6-4.png" width="100%"></p><p>&emsp;&emsp;<span>之后设置如下数据采样时间和窗口时间。</span></p><p><img src="./images/6-5.png" width="100%"></p><p>&emsp;&emsp;<span>接下来就可以打开Watch View或Scope View进行变量观察，关于X2CScope的具体操作和相关知识详见参考资料[3]，示意如下：</span></p><p><img src="./images/6-6.png" width="100%"></p><p><img src="./images/6-7.png" width="100%"></p><p>&emsp;&emsp;<span>上图通过软件示波器可以看到输出电压采样（红色线）有毛刺，可修改为如下控制器，通过降低带宽使系统更稳定，PowerSmart™重新生成控制器代码并烧录器件后输出电压毛刺将消失。</span></p><p><img src="./images/6-8.png" width="100%"></p><p><img src="./images/6-9.png" width="100%"></p><h2 id='3-参考资料'><span>3. 参考资料</span></h2><p><span>[1] </span><a href='https://ww1.microchip.com/downloads/en/DeviceDoc/UG20220108_powersmart_qsg.pdf'><span>MPLAB® PowerSmart™ Development Suite Quick Start Guide</span></a></p><p><span>[2] </span><a href='https://ww1.microchip.com/downloads/en/DeviceDoc/UG20220105A_psdcld_user%27s_guide.pdf'><span>MPLAB® PowerSmart™ Digital Control Library Designer User&#39;s Guide</span></a></p><p><span>[3] </span><a href='https://ww1.microchip.com/downloads/aemDocuments/documents/MCU16/ProductDocuments/UserGuides/Power-Board-Visualizer-User-Guide-50003115.pdf'><span>Power Board Visualizer User&#39;s Guide</span></a></p><p><span>[4] </span><a href='https://mu.microchip.com/using-x2cscope-to-simply-motor-control-development-and-debugging'><span>Using X2CScope to Simplify Motor Control Development and Debugging</span></a></p><p><span>[5] </span><a href='https://ww1.microchip.com/downloads/en/DeviceDoc/52064A.pdf'><span>MCP2200 Breakout Module User&#39;s Guide</span></a></p><p><span>[6] </span><a href='https://ww1.microchip.com/downloads/en/DeviceDoc/dsPIC33C-Digital-Power-Starter-Kit-Users-Guide-DS50002867B.pdf'><span>dsPIC33C Digital Power Starter Kit User&#39;s Guide</span></a></p><p>&nbsp;</p><hr /><p>&nbsp;</p></div></div>
</body>
</html>